<script type="text/javascript" src="http://bp.yahooapis.com/2.4.21/browserplus-min.js"></script>
<!-- <script type="text/javascript"  src="http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js"></script> -->
<div id="upload-popup">
	<h1><?php echo lang('uploking_upload_file_label')?></h1>
	<div id="container">
	    <div id="filelist"></div>
	    <br />
	    <div id="container-bottom">
	    	<div id="container-bottom-left">
	    		<a class="selecte-file-button" id="pickfiles" href="javascript:;"><span>Select</span></a>
	    	</div>
	    	<div id="container-bottom-right">
		    	<a class="upload-button" id="uploadfiles" href="javascript:;">Upload</a>
		    </div>
		    <div class="clear"></div>
	    </div>
	</div>
	
	
	<script type="text/javascript">
	// Custom example logic
	function $(id) {
		return document.getElementById(id);	
	}
	//alert(jQuery('ul.ui-sortable').find('a.selected').attr('rel'));
	
	var uploader = new plupload.Uploader({
		runtimes : 'gears,html5,flash,silverlight,browserplus',
		browse_button : 'pickfiles',
		container: 'container',
		chunk_size: '1mb',
		max_file_size : '10000mb',
		url : SITE_URL + 'file_manager/upload/do_upload',
		resize : {width : 320, height : 240, quality : 90},
		flash_swf_url : '../js/plupload.flash.swf',
		silverlight_xap_url : '../js/plupload.silverlight.xap'
			/*
		filters : [
			{title : "Video files", extensions : "mp4,flv,dat"},
			{title : "Image files", extensions : "jpg,gif,png"},
			{title : "Zip files", extensions : "zip, rar"},
			{title : "All files", extensions : "*.*"}
		]
			*/
	});
	
	uploader.bind('Init', function(up, params) {
		//$('filelist').innerHTML = "<div>Current runtime: " + params.runtime + "</div>";
	});
	
	uploader.bind('FilesAdded', function(up, files) {
		for (var i in files) {
			$('filelist').innerHTML += '<div id="' + files[i].id + '">' + files[i].name + ' (' + plupload.formatSize(files[i].size) + ') <b></b></div>';
		}
	});
	
	uploader.bind('UploadProgress', function(up, file) {
		$(file.id).getElementsByTagName('b')[0].innerHTML = '<span>' + file.percent + "%</span>";
	});
	
	$('uploadfiles').onclick = function() {
		uploader.start();
		return false;
	};
	
	uploader.init();
	</script>
</div>